package org.n.shop.service.impl;

import lombok.AllArgsConstructor;
import org.n.shop.domain.vo.ListVo;
import org.n.shop.mapper.TypeMapper;
import org.n.shop.result.RestResult;
import org.n.shop.result.RestResultBuilder;
import org.n.shop.service.TypeService;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class TypeServiceImpl implements TypeService {
    private TypeMapper typeMapper;

    @Override
    public RestResult all(int page, int pageSize) {
        return new RestResultBuilder().success(
                ListVo.builder()
                        .list(typeMapper.all(page, pageSize))
                        .total(typeMapper.total())
                        .build()
        );
    }
}
